home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / wg_lib / filefrm1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-06  |  7.4 KB  |  253 lines

  1. VERSION 2.00
  2. Begin Form FileFrm1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "File Creation"
  5.    ClientHeight    =   3555
  6.    ClientLeft      =   1050
  7.    ClientTop       =   1755
  8.    ClientWidth     =   4185
  9.    Height          =   3960
  10.    Left            =   990
  11.    LinkMode        =   1  'Source
  12.    LinkTopic       =   "Form1"
  13.    ScaleHeight     =   3555
  14.    ScaleWidth      =   4185
  15.    Top             =   1410
  16.    Width           =   4305
  17.    Begin Frame Frame2 
  18.       BackColor       =   &H00C0C0C0&
  19.       Caption         =   "File Status"
  20.       Height          =   1365
  21.       Left            =   480
  22.       TabIndex        =   7
  23.       Top             =   1980
  24.       Width           =   3345
  25.       Begin Label Stat 
  26.          BackColor       =   &H00C0C0C0&
  27.          Height          =   180
  28.          Index           =   4
  29.          Left            =   1215
  30.          TabIndex        =   15
  31.          Top             =   1095
  32.          Width           =   1650
  33.       End
  34.       Begin Label Label4 
  35.          BackColor       =   &H00C0C0C0&
  36.          Caption         =   "Error Code:"
  37.          Height          =   180
  38.          Left            =   90
  39.          TabIndex        =   11
  40.          Top             =   1095
  41.          Width           =   1050
  42.       End
  43.       Begin Label Stat 
  44.          BackColor       =   &H00C0C0C0&
  45.          Height          =   180
  46.          Index           =   3
  47.          Left            =   1215
  48.          TabIndex        =   14
  49.          Top             =   855
  50.          Width           =   1635
  51.       End
  52.       Begin Label Label3 
  53.          BackColor       =   &H00C0C0C0&
  54.          Caption         =   "Handle:"
  55.          Height          =   270
  56.          Left            =   420
  57.          TabIndex        =   10
  58.          Top             =   825
  59.          Width           =   735
  60.       End
  61.       Begin Label Stat 
  62.          BackColor       =   &H00C0C0C0&
  63.          Height          =   210
  64.          Index           =   2
  65.          Left            =   1215
  66.          TabIndex        =   13
  67.          Top             =   585
  68.          Width           =   1635
  69.       End
  70.       Begin Label Label2 
  71.          BackColor       =   &H00C0C0C0&
  72.          Caption         =   "Size:"
  73.          Height          =   285
  74.          Left            =   630
  75.          TabIndex        =   9
  76.          Top             =   585
  77.          Width           =   480
  78.       End
  79.       Begin Label Stat 
  80.          BackColor       =   &H00C0C0C0&
  81.          Height          =   225
  82.          Index           =   1
  83.          Left            =   1200
  84.          TabIndex        =   12
  85.          Top             =   300
  86.          Width           =   1635
  87.       End
  88.       Begin Label Label1 
  89.          BackColor       =   &H00C0C0C0&
  90.          Caption         =   "Status:"
  91.          Height          =   195
  92.          Left            =   435
  93.          TabIndex        =   8
  94.          Top             =   300
  95.          Width           =   690
  96.       End
  97.    End
  98.    Begin Frame Frame1 
  99.       BackColor       =   &H00C0C0C0&
  100.       Caption         =   "File Function"
  101.       Height          =   1620
  102.       Left            =   480
  103.       TabIndex        =   0
  104.       Top             =   270
  105.       Width           =   3330
  106.       Begin OptionButton FOpt 
  107.          BackColor       =   &H00C0C0C0&
  108.          Caption         =   "FDelete"
  109.          Height          =   240
  110.          Index           =   5
  111.          Left            =   1065
  112.          TabIndex        =   16
  113.          Top             =   1320
  114.          Width           =   1125
  115.       End
  116.       Begin OptionButton FOpt 
  117.          BackColor       =   &H00C0C0C0&
  118.          Caption         =   "FClose"
  119.          Height          =   210
  120.          Index           =   4
  121.          Left            =   1755
  122.          TabIndex        =   6
  123.          Top             =   1035
  124.          Width           =   1335
  125.       End
  126.       Begin OptionButton FOpt 
  127.          BackColor       =   &H00C0C0C0&
  128.          Caption         =   "FCreate"
  129.          Height          =   210
  130.          Index           =   2
  131.          Left            =   210
  132.          TabIndex        =   4
  133.          Top             =   1020
  134.          Width           =   1155
  135.       End
  136.       Begin OptionButton FOpt 
  137.          BackColor       =   &H00C0C0C0&
  138.          Caption         =   "FOpen"
  139.          Height          =   270
  140.          Index           =   3
  141.          Left            =   1755
  142.          TabIndex        =   5
  143.          Top             =   735
  144.          Width           =   1065
  145.       End
  146.       Begin OptionButton FOpt 
  147.          BackColor       =   &H00C0C0C0&
  148.          Caption         =   "FUnique"
  149.          Height          =   285
  150.          Index           =   1
  151.          Left            =   210
  152.          TabIndex        =   3
  153.          Top             =   705
  154.          Width           =   1095
  155.       End
  156.       Begin TextBox Text1 
  157.          BackColor       =   &H00C0C0C0&
  158.          Height          =   375
  159.          Left            =   705
  160.          TabIndex        =   1
  161.          Top             =   270
  162.          Width           =   2295
  163.       End
  164.       Begin Label title 
  165.          BackColor       =   &H00C0C0C0&
  166.          Caption         =   "File:"
  167.          Height          =   255
  168.          Left            =   120
  169.          TabIndex        =   2
  170.          Top             =   375
  171.          Width           =   495
  172.       End
  173.    End
  174. DefInt A-Z
  175. Dim FHandle As Integer
  176. Dim FErrc As Integer
  177. Dim OldNdx As Integer
  178. Sub Ffclose ()
  179.     FErrc = FClose(FHandle)
  180. End Sub
  181. Sub FFCreate ()
  182.      Fil$ = LTrim$(RTrim$(text1.text))
  183.      FErrc = FCreat(Fil$, FHandle)
  184. End Sub
  185. Sub FFOpen ()
  186.      Fil$ = LTrim$(RTrim$(text1.text))
  187.      FErrc = FOpen(Fil$, FHandle)
  188. End Sub
  189. Sub ffunique ()
  190.      Fil$ = "C:\" + Chr$(0) + Space$(15)
  191.      FErrc = FUnique(Fil$, 32, FHandle)
  192.      text1.text = LTrim$(RTrim$(Fil$))
  193. End Sub
  194. Sub FOpt_Click (Index As Integer)
  195.     ' close any file we have open
  196.     If FHandle > 0 Then
  197.         errc = FClose(FHandle)
  198.     End If
  199.     Select Case Index
  200.         Case 1
  201.           Call ffunique
  202.         Case 2
  203.           If Len(text1.text) = 0 Then
  204.               text1.text = "TEST.DOC"
  205.           End If
  206.           Call FFCreate
  207.         Case 3
  208.           If Len(text1.text) = 0 Then
  209.               text1.text = "TEST.DOC"
  210.           End If
  211.           Call FFOpen
  212.         Case 4
  213.           If Len(text1.text) = 0 Then
  214.               text1.text = "TEST.DOC"
  215.           End If
  216.           Call Ffclose
  217.         Case 5
  218.           If Len(text1.text) Then
  219.               Fil$ = LTrim$(RTrim$(text1.text))
  220.               Msg$ = "Do you really want do delete " + Fil$ + " ?"
  221.               retc = MsgBox(Msg$, 4 + 48, "Warning")
  222.               If retc = 6 Then
  223.                   FErrc = FDelete(Fil$)
  224.                   FHandle = 0
  225.               End If
  226.           End If
  227.         End Select
  228.     OldNdx = Index
  229.     UpdateStatus
  230. End Sub
  231. Sub Form_Load ()
  232.      OldNdx = 0
  233. End Sub
  234. Sub Form_Paint ()
  235.    Call ConvexFrm(FileFrm1, 3)
  236.    ConvexCtl Frame1, 2
  237.    ConvexCtl Frame2, 2
  238. End Sub
  239. Sub UpdateStatus ()
  240.      If FHandle Then
  241.          Stat(1).Caption = "Open"
  242.          lret& = FSizeH&(FHandle)
  243.          Stat(2).Caption = Str$(lretc&)
  244.          Stat(3).Caption = Str$(FHandle)
  245.          Stat(4).Caption = Str$(FErrc)
  246.      Else
  247.          Stat(1).Caption = "Closed"
  248.          Stat(2).Caption = Str$(0)
  249.          Stat(3).Caption = Str$(0)
  250.          Stat(4).Caption = "None"
  251.      End If
  252. End Sub
  253.